<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>积分兑换</title>
    <script src="js/flexible.js"></script>
    <link rel="stylesheet" href="css/flexible.css">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/vant.css">
    <script src="js/vue/vue.js"></script>
    <script src="js/vue/axios.js"></script>
    <script src="js/vue/MD5.js"></script>
    <script src="js/vue/vant.js"></script>
</head>
<body>
<div id="app">
    <div>
        <div class="jf_dh">
            <p>{{Count}}</p>
            <p>可用积分</p>
            <div class="jfdh_btn">
                <div><a href="jf_record.html">积分记录</a></div>
                <div><a href="integralRules.html">积分细则</a></div>
            </div>
        </div>
        <div class="jfdh_content" v-if="Goods.length>0">
            <div class="jfdh_List" v-for="item in Goods" :key="item.id">
                <img :src="item.Pic" onerror="this.src='images/zwt1.png'"/>
                <p class="jfdh_name">{{item.GoodsName}}</p>
                <div>
                    <div class="jfdh_jf">{{item.Integral}}积分</div>
                    <div class="jfdh_btnClick" @click="dh(item.id)">兑换</div>
                </div>
            </div>
        </div> 
        <div class="zwjfsp" v-else>
            <img src="images/zwjfsp.jpg"/>
        </div>
        </div> 
    </div>
</div>
</body>
<script>
var app = new Vue({
    el: '#app',
    data: {
        Goods:[],
        Count:'',
    },
    created(){
        this.getJflist()
    },
  
    methods: {
        getJflist(){
            axios.get('/mobileapi/member/user_info.php?act=integral_exchange').then(data =>{
                let { msg, code} = data.data
                    if (code != 200) {
                        window.vant.Toast.fail(msg)
                    } else {
                        data=data.data
                        this.Count =data.data.Count
                        this.Goods =data.data.Goods
                    }
                }).catch(function (error) {
                    console.log(error); 
            })
        },
        //兑换跳转
        dh(id){
            window.location.href='integralOrder.html?id='+id+''
        }
    }  
})    
</script>
</html>